package ex3.render.raytrace;

import java.util.Map;
import math.Point3D;
import math.Vec;

public class DirectionalLight extends Light
{

    public DirectionalLight()
    {
        dir = new Vec(0.0D, 0.0D, 0.0D);
        color = new Vec(1.0D, 1.0D, 1.0D);
    }

    public void init(@SuppressWarnings("rawtypes") Map attributes)
    {
        super.init(attributes);
        if(attributes.containsKey("direction"))
        {
            dir = new Vec((String)attributes.get("direction"));
            dir.normalize();
        }
    }

    public Vec getColor(Point3D at)
    {
        return color;
    }

    public Vec getDirection(Point3D at)
    {
        return Vec.negate(dir);
    }

    public double getShadow(Point3D at, double minIntersectionDist)
    {
        return 1.0D;
    }

    protected Vec dir;
}